package com.rocker.client.websocket.config;

import com.rocker.client.websocket.handler.WebSocketDemoHanlder;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;

/**
 * @Author 喻湘东
 * @Create 2019-11-23 00:45:15
 */
@Configuration
@EnableWebSocket
public class WebsocketConfig implements WebSocketConfigurer {

    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry webSocketHandlerRegistry) {
        webSocketHandlerRegistry.addHandler(new WebSocketDemoHanlder(),"/wsco").setAllowedOrigins("*");
    }
}
